package top.byfree.jbyan.find.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class KeyEntry {

    private Integer index;

    private String key;

    public static KeyEntry create(Integer index, String key) {
        return new KeyEntry(index, key);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        KeyEntry keyEntry = (KeyEntry) o;

        return key.equals(keyEntry.key);
    }

    @Override
    public int hashCode() {
        return key.hashCode();
    }
}
